package com.yidu.service.serviceImpl;

import com.yidu.entity.Users;
import com.yidu.mapper.UsersMapper;
import com.yidu.service.UsersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class UsersServiceImpl implements UsersService {
    @Autowired
    private UsersMapper usersMapper;

    @Override
    public List<Users> selectUsers(int page, int limit) {
        Map map = new HashMap();
        map.put("page", (page - 1) * limit);
        map.put("limit", (page - 1) * limit + limit);
        return usersMapper.selectUsers(map);
    }

    @Override
    public void insertUsers(Users users) {
        usersMapper.insertUsers(users);
    }

    @Override
    public void updateUsers(Users users) {
        usersMapper.updateUsers(users);
    }

    @Override
    public void deleteUsers(int usersId) {
        usersMapper.deleteUsers(usersId);
    }

    @Override
    public Users selectUser(String usersName, String usersPassword) {
        return usersMapper.selectUser(usersName, usersPassword);
    }
}
